import datetime
from django.conf import settings
import jwt

key=settings.SECRET_KEY
class MyJwt:
    def gettoken(self,id,user):
        data={
            "id":id,
            'account':user,
            "exp":datetime.datetime.now()+datetime.timedelta(hours=2)
        }

        return jwt.encode(data,key,algorithm='HS256')

    def checktoen(self,token):

        return jwt.decode(token,key,algorithms='HS256')


